package cqupt.spark_log.fileio;

import cqupt.spark_log.contrant.Contant;
import cqupt.spark_log.entity.EnergyTime;
import cqupt.spark_log.info.BanchInfo;
import cqupt.spark_log.info.EnergyInfo;
import cqupt.spark_log.utils.Utils;

public class ExcelManByStage {

	public EnergyTime getresult(String appName, String path, String stageName) {
		Contant.APP_NAME = appName;
		String experimentPath = Utils.getExperimentPath(Contant.BASE_PATH);
		Contant.BASE_PATH = experimentPath + path + "/" + Contant.APP_NAME;
		EnergyTime energyTime = new EnergyTime();
		BanchInfo banchInfo = new BanchInfo();
		banchInfo.exe();
		EnergyInfo energyInfo = new EnergyInfo(banchInfo);
		energyInfo.run();
		double energy = energyInfo.calculate(stageName);
		Long time = energyInfo.getStageTime(stageName);
		energyTime.setEnergy(energy + "");
		energyTime.setTime(time + "");
		return energyTime;
	}
}
